/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cajero.Interfaz;

import java.awt.Graphics;
import java.awt.Image;
import javax.swing.Icon;
import javax.swing.ImageIcon;

/**
 *
 * @author Yalile Bermudes
 */
public class ProductoBuscado extends javax.swing.JPanel {

    private static final long serialVersionUID = 1L;
    private Image bgImage;

    /**
     * Creates new form ProductoBuscado
     */
    public ProductoBuscado() {
        initComponents();
        this.setVisible(true);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpInformacion = new javax.swing.JPanel();
        lbCodigo = new javax.swing.JLabel();
        txProducto = new javax.swing.JTextField();
        lbNombre = new javax.swing.JLabel();
        txNombreProducto = new javax.swing.JTextField();
        lbPrecio = new javax.swing.JLabel();
        txPrecio = new javax.swing.JTextField();
        lbCaracteristicas = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        txaDetalles = new javax.swing.JTextArea();
        lbDisponible = new javax.swing.JLabel();
        jScrollPane5 = new javax.swing.JScrollPane();
        tbDisponibles = new javax.swing.JTable();
        jpFoto = new javax.swing.JPanel();
        lbImagen = new javax.swing.JLabel();
        lbDescripcion = new javax.swing.JLabel();
        jScrollPane6 = new javax.swing.JScrollPane();
        txaDescripcion = new javax.swing.JTextArea();
        jLabel1 = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jpProductos = new javax.swing.JPanel();
        lbProductoBuscado = new javax.swing.JLabel();
        txNombreBuscado = new javax.swing.JTextField();
        btBuscar = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        listProductos = new javax.swing.JList();

        setOpaque(false);
        setVerifyInputWhenFocusTarget(false);

        jpInformacion.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpInformacion.setOpaque(false);
        jpInformacion.setVerifyInputWhenFocusTarget(false);

        lbCodigo.setText("Codigo de producto:");

        txProducto.setEditable(false);

        lbNombre.setText("Nombre:");

        txNombreProducto.setEditable(false);

        lbPrecio.setText("Percio Unitario:");

        txPrecio.setEditable(false);

        lbCaracteristicas.setText("Caracteristicas:");

        txaDetalles.setColumns(20);
        txaDetalles.setEditable(false);
        txaDetalles.setRows(5);
        jScrollPane4.setViewportView(txaDetalles);

        lbDisponible.setText("Disponibilidad:");

        tbDisponibles.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Sucursal", "Unidades"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane5.setViewportView(tbDisponibles);

        jpFoto.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpFoto.setOpaque(false);
        jpFoto.setLayout(new java.awt.GridBagLayout());

        lbImagen.setText("FOTO");
        jpFoto.add(lbImagen, new java.awt.GridBagConstraints());

        lbDescripcion.setText("Descripcion:");

        txaDescripcion.setColumns(20);
        txaDescripcion.setEditable(false);
        txaDescripcion.setRows(5);
        jScrollPane6.setViewportView(txaDescripcion);

        jLabel1.setText("Fabricante:");

        jTextField1.setEditable(false);

        javax.swing.GroupLayout jpInformacionLayout = new javax.swing.GroupLayout(jpInformacion);
        jpInformacion.setLayout(jpInformacionLayout);
        jpInformacionLayout.setHorizontalGroup(
            jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformacionLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addComponent(jpFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jpInformacionLayout.createSequentialGroup()
                                .addComponent(lbCodigo)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpInformacionLayout.createSequentialGroup()
                                .addComponent(lbPrecio)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txPrecio))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jpInformacionLayout.createSequentialGroup()
                                .addComponent(lbNombre)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txNombreProducto, javax.swing.GroupLayout.PREFERRED_SIZE, 156, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jpInformacionLayout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addGap(18, 18, 18)
                                .addComponent(jTextField1))))
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addComponent(lbCaracteristicas)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 303, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addComponent(lbDisponible)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 319, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addComponent(lbDescripcion)
                        .addGap(2, 2, 2)
                        .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jpInformacionLayout.setVerticalGroup(
            jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpInformacionLayout.createSequentialGroup()
                .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addGap(6, 6, 6)
                        .addComponent(jpFoto, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jpInformacionLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbCodigo)
                            .addComponent(txProducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbNombre)
                            .addComponent(txNombreProducto, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(lbPrecio)
                            .addComponent(txPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(4, 4, 4)
                .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbCaracteristicas)
                    .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13)
                .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbDisponible)
                    .addComponent(jScrollPane5, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(5, 5, 5)
                .addGroup(jpInformacionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lbDescripcion)
                    .addComponent(jScrollPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(13, Short.MAX_VALUE))
        );

        jpProductos.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jpProductos.setOpaque(false);
        jpProductos.setVerifyInputWhenFocusTarget(false);

        lbProductoBuscado.setText("Nombre del producto a consultar:");

        btBuscar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/buscar.png"))); // NOI18N
        btBuscar.setToolTipText("");

        jScrollPane1.setViewportView(listProductos);

        javax.swing.GroupLayout jpProductosLayout = new javax.swing.GroupLayout(jpProductos);
        jpProductos.setLayout(jpProductosLayout);
        jpProductosLayout.setHorizontalGroup(
            jpProductosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpProductosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpProductosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane1)
                    .addGroup(jpProductosLayout.createSequentialGroup()
                        .addGroup(jpProductosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lbProductoBuscado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txNombreBuscado))
                        .addGap(18, 18, 18)
                        .addComponent(btBuscar, javax.swing.GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jpProductosLayout.setVerticalGroup(
            jpProductosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpProductosLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jpProductosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btBuscar, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jpProductosLayout.createSequentialGroup()
                        .addComponent(lbProductoBuscado)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txNombreBuscado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 355, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpProductos, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGap(18, 18, 18)
                .addComponent(jpInformacion, javax.swing.GroupLayout.PREFERRED_SIZE, 459, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jpProductos, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jpInformacion, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
    }// </editor-fold>//GEN-END:initComponents


    void setCodigo(String codigo) {
        txProducto.setText(codigo);
    }

    void setNombre(String Nombre) {
        txNombreProducto.setText(Nombre);
    }

    void setPrecio(String precio) {
        txPrecio.setText(precio);
    }

    void setDetalles(String descripcion) {
        txaDetalles.setText(descripcion);
    }

    void setImagen(Image imagen) {
        double alto = imagen.getHeight(null) / Math.ceil(imagen.getHeight(null) / 300f);
        double ancho = imagen.getWidth(null) / Math.ceil(imagen.getWidth(null) / 320f);
        Icon icon = new ImageIcon(imagen.getScaledInstance((int) ancho, (int) alto, Image.SCALE_AREA_AVERAGING));
        this.lbImagen.setText("");
        this.lbImagen.setIcon(icon);
    }

    void setTabla() {
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btBuscar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane6;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JPanel jpFoto;
    private javax.swing.JPanel jpInformacion;
    private javax.swing.JPanel jpProductos;
    private javax.swing.JLabel lbCaracteristicas;
    private javax.swing.JLabel lbCodigo;
    private javax.swing.JLabel lbDescripcion;
    private javax.swing.JLabel lbDisponible;
    private javax.swing.JLabel lbImagen;
    private javax.swing.JLabel lbNombre;
    private javax.swing.JLabel lbPrecio;
    private javax.swing.JLabel lbProductoBuscado;
    private javax.swing.JList listProductos;
    private javax.swing.JTable tbDisponibles;
    private javax.swing.JTextField txNombreBuscado;
    private javax.swing.JTextField txNombreProducto;
    private javax.swing.JTextField txPrecio;
    private javax.swing.JTextField txProducto;
    private javax.swing.JTextArea txaDescripcion;
    private javax.swing.JTextArea txaDetalles;
    // End of variables declaration//GEN-END:variables
}
